
<template>
  <div class="swiper-container">
    <div class="swiperbox">
      <swiper class="swiper" :slidesPerView="6" :spaceBetween="3" :centeredSlides="false" :modules="modules">
        <swiper-slide class="swiper-item" v-for="(s, index) in props?.imglist" :key="index">
          <img @click="sendImg(s.imgUrl)" :src="s.imgUrl" alt="" />
        </swiper-slide>
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
      </swiper>
    </div>
  </div>
</template>

<script lang="ts" setup>


import { Swiper, SwiperSlide } from 'swiper/vue' // swiper 所需组件
import { Autoplay, Navigation, Pagination, A11y } from 'swiper'// 分页器
import 'swiper/swiper-bundle.css'
import 'swiper/css'
import 'swiper/css/navigation'
import 'swiper/css/pagination'
import { ref } from 'vue'
import $bus from '../../../bus/index'

const modules = [Autoplay, Pagination, Navigation, A11y]
const props = defineProps<{
  imglist?: []
}>()

const emit= defineEmits<{
  sendImg:[image:string]

}>()

const sendImg=(value:string)=>{
  // console.log(image)
  $bus.emit('mage',value)
}




</script>

<script lang="ts">

// import Swiper from 'swiper'
export default {
  name: "VImageList",
}
</script>

<style lang="scss" scoped>
.swiper-container {
  height: 56px;
  width: 412px;
  box-sizing: border-box;
  padding: 0 12px;

  .swiper-slide {
    width: 56px;
    height: 56px;

    img {
      width: 100%;
      height: 100%;
      border: 1px solid #ccc;
      padding: 2px;
      width: 50px;
      height: 50px;
      display: block;

      &.active {
        border: 2px solid #f60;
        padding: 1px;
      }

      &:hover {
        border: 2px solid #f60;
        padding: 1px;
      }
    }
  }

  .swiper-button-next {
    left: auto;
    right: 0;
  }

  .swiper-button-prev {
    left: 0;
    right: auto;
  }

  .swiper-button-next,
  .swiper-button-prev {
    box-sizing: border-box;
    width: 12px;
    height: 56px;
    background: rgb(235, 235, 235);
    border: 1px solid rgb(204, 204, 204);
    top: 0;
    margin-top: 0;

    &::after {
      font-size: 12px;
    }
  }
}
</style>